package com.chuang.bootplus.controller;


import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.po.topic.TopicListPO;
import com.chuang.bootplus.po.topic.TopicSavePO;
import com.chuang.bootplus.service.TopicService;
import com.chuang.bootplus.vo.TopicListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-17
 */
@RestController
@RequestMapping("/topic")
@Api(tags = "碳圈 话题")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class TopicController {
    final TopicService topicService;

    @PostMapping("save")
    @ApiOperation("添加话题")
    public ApiResponse<Void> save(@RequestBody TopicSavePO po){
        return topicService.save(po);
    }

    @PostMapping("list")
    @ApiOperation("获取话题列表")
    public ApiResponse<TopicListVO> list(@RequestBody TopicListPO po){
        return topicService.list(po);
    }

}

